<!--
 * @Autor: 黄旗
 * @Date: 2020-07-17 09:00:14
-->
<template>
	<RadioGroup
        v-show="params.show ? params.show.show : true"
		v-model="params.value"
		:type="params.type"
		:style="params.style"
		:size="params.size"
		:button-style="params.buttonStyle"
		:disabled="params.disabled"
		@on-change="$emit('on-change', $event)"
	>
		<template v-if="params.icon">
			<Radio
				:size="params.size"
				:disabled="params.disabled"
				:border="params.border"
				:true-value="params.trueValue"
				:false-value="params.falseValue"
				v-for="it in params.childList"
				:label="params.field && params.field.value ? it[params.field.value] : it.value"
				:key="params.field && params.field.value ? it[params.field.value] : it.value"
			>
				<Icon :type="it.icon"></Icon>
				<span>{{ params.field && params.field.label ? it[params.field.label] : it.label }}</span>
			</Radio>
		</template>
		<template v-if="!params.icon">
			<Radio
				:size="params.size"
				:disabled="params.disabled"
				:border="params.border"
				:true-value="params.trueValue"
				:false-value="params.falseValue"
				v-for="it in params.childList"
				:key="params.field && params.field.value ? it[params.field.value] : it.value"
				:label="params.field && params.field.value ? it[params.field.value] : it.value"
			>{{ params.field && params.field.label ? it[params.field.label] : it.label }}</Radio>
		</template>
	</RadioGroup>
</template>

<script>
export default {
  props: ["params"],
};
</script>
